{% extends 'sys_templates/public/base.html' %}
{% block content %}
    <!-- 右侧内容框架，更改从这里开始 -->
    <xblock>
        <button class="layui-btn layui-btn-danger" {% if title=='会员列表' %}onclick="delAll()"{% else %}onclick="delete_unset()"{% endif %}><i class="layui-icon">&#xe640;</i>批量删除</button>
        <form class="layui-form xbs" style="float: right;margin-left: 30px">
            <div class="layui-input-inline">
                <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline" style="width:80px">
                <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>
                </button>
            </div>
        </form>
        {% if title!='已删除会员列表' %}
            <button class="layui-btn layui-btn-normal" onclick="member_add('添加用户','{{ url_for('cms_bp.member_add') }}','600','500')"><i
                    class="layui-icon">&#xe608;</i>添加
            </button>
        {% endif %}

        <span class="x-right" style="line-height:40px">共有数据：{{ data_s |count }} 条</span></xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>
                <input type="checkbox" name="check_all" value=""> 全选
            </th>
            <th>用户名</th>
            <th>性别</th>
            <th>QQ</th>
            <th>邮箱</th>
            <th>积分</th>
            <th>加入时间</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for data in data_s %}
            <tr>
                <td>
                    <input type="checkbox" value="{{ data.id }}" name="checkbox"> ID:{{ data.id }}
                </td>
                <td>
                    {{ data.username }}
                </td>
                <td>
                    {% if data.gender==1 %}保密{% elif data.gender==2 %}男{% else %}女{% endif %}
                </td>
                <td>{{ data.qq or '' }}</td>
                <td>{{ data.email }}</td>
                <td>{{ data.credits }}</td>
                <td>{{ data.update_time }}</td>
                <td class="td-status">
                            <span class="layui-btn {% if data.status==0 %}layui-btn-danger{% elif data.status==1 %}layui-btn-normal {% else %}layui-btn-disabled{% endif %} layui-btn-mini">
                                {% if data.status==0 %}已删除{% elif data.status==1 %}已启用{% else %}已停用{% endif %}
                            </span>
                </td>
                <td class="td-manage">
                    {% if title!='已删除会员列表' %}
                        <a style="text-decoration:none"
                           {% if data.status==1 %}onclick="member_stop(this,'{{ data.id }}',-1)"
                           {% else %}onclick="member_start(this,'{{ data.id }}',1)"{% endif %} href="javascript:;"
                           title="{% if data.status==1 %}停用{% else %}启用{% endif %}">
                            <i class="layui-icon">{% if data.status==1 %}&#xe601;{% else %}&#xe62f;{% endif %}</i>
                        </a>
                        <a title="编辑" href="javascript:;"
                           onclick="member_edit('编辑','{{ url_for('cms_bp.member_edit',id=data.id) }}?uid={{ data.uuid }}','','600','500')"
                           class="ml-5" style="text-decoration:none">
                            <i class="layui-icon">&#xe642;</i>
                        </a>
                        <a style="text-decoration:none"
                           onclick="member_password('修改密码','{{ url_for('cms_bp.password_edit',id=data.id) }}','{{ data.id }}','600','400')"
                           href="javascript:;" title="修改密码">
                            <i class="layui-icon">&#xe631;</i>
                        </a>
                        <a title="删除" href="javascript:;" onclick="member_del(this,'{{ data.id }}')"
                           style="text-decoration:none">
                            <i class="layui-icon">&#xe640;</i>
                        </a>
                    {% else %}
                        <a style="text-decoration:none" onclick="member_recover(this,'{{ data.id }}')" href="javascript:;" title="恢复">
                            <i class="layui-icon">&#xe618;</i>
                        </a>
                        <a title="彻底删除" href="javascript:;" onclick="member_unset(this,'{{ data.id }}')"
                           style="text-decoration:none">
                            <i class="layui-icon">&#xe640;</i>
                        </a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if page.pages>1 %}
    <div class="layui-card-body ">
        <div class="page">
            <div>
            <a {% if page.has_prev %}class="next" href="{{ url_for(url) }}?page={{ page.prev_num }}" {% else %}class="layui-btn-disabled"{% endif %}>上一页</a>
                {% for pg in page.iter_pages(2,2,2,2) %}
                    {% if page.page==pg %}
                        <span class="current">{{ pg }}</span>
                    {% else %}
                        {% if pg %}
                        <a class="num" href="{{ url_for(url) }}?page={{ pg }}">{{ pg }}</a>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% if not page.pages==page.page %}
            <a class="num" href="{{ url_for(url) }}?page={{ page.pages }}">最后一页</a>
                {% endif %}
                <a {% if page.has_next %}class="next" href="{{ url_for(url) }}?page={{ page.next_num }}" {% else %}class="layui-btn-disabled"{% endif %}>下一页</a>
            </div>
        </div>
    </div>
    {% endif %}
{% endblock %}